<div id="wall">
	<div id="ajax_wall"></div>
</div><!--end wall-->
<script type="text/javascript">
$(document).ready(function(){
	function wall_cm(user,info_id){
		$.post("ajax_wall.php",{view_wall_one:"view_wall_one",user:user,info_id:info_id},function(data){
			$("#ajax_wall").html(data);
		});
	}
	wall_cm("<?php echo $user?>","<?php echo $_GET['id']?>");
	
	$(".binhluan").live("click",function(){
		var id = ($(this).attr("class")).split(" ");
		$(".show_cm"+id[1]).css('display','inline');
		$("#comment"+id[1]).focus();
		$("#comment"+id[1]).keydown(function(e){
			var key = e.keyCode;
			if(key==13){
				var cm = $(this).val();
				if(cm!=''){
					$(this).attr("readonly",true);
					$.post("ajax.php",{comment:"comment",id:id[1],cm:cm},function(){
						var str = '<div class="comment"><div class="comment_img"><a href="index.html?user=<?php echo $idUser?>"><img src="<?php echo $avatar; ?>" alt=""></a></div><div class="comment_cm"><a href="index.html?user=<?php echo $idUser?>"><strong><?php echo $_SESSION['name']; ?></strong></a> ' + cm + '<div class="date"></div></div><div style="clear:both; height:1px"></div></div>';
						$("#ajax_wall_cm"+id[1]).prepend(str);
						$("#comment"+id[1]).val('');
						setTimeout(function(){$("#comment"+id[1]).attr("readonly",false);},500);
					});
				}
			}
		});
	});
	
	$(".info .delete").live("click",function(){
		var id = ($(this).attr("class")).split(" ");
		if(confirm("Bạn có muốn xóa?")){
			$.post("ajax.php",{deleteinfo:"deleteinfo",id:id[1],user:"<?php echo $user?>"},function(){
				$(".info"+id[1]).css('display','none');
			});
		}
	});
	
	$('.like').live("click",function(){
		var id = ($(this).attr('class')).split("_");
		var name = ($(this).attr('class')).split(" ");
		$.post("like.php",{user_like:"user_like",id:id[1],id2:<?php if(@$idUser) echo $idUser; else echo '""'?>},function(){
			if($('.'+name[1]).html()=='Thích') $('.'+name[1]).html('Bỏ thích');
			else $('.'+name[1]).html('Thích');
		});
	});
});
</script>